package com.tian.producer;

import com.alibaba.fastjson.JSON;
import com.tian.constant.RabbitMQConstant;
import com.tian.enums.MessageFailedRetryTypeEnum;
import com.tian.message.DelayDeleteCacheMessage;
import com.tian.message.InvitedRegistryMessage;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * {@code @description:} 发送用户邀请消息
 *
 * @author tianwc 公众号：Java后端技术全栈
 * 在线刷题 1200+java面试题和1000+篇技术文章：<a href="https://woaijava.cc/">博客地址</a>
 * {@code @date:} 2024/1/26 20:59
 * {@code @version:} 1.0
 */
@Slf4j
@Component
public class DelayDeleteCacheProducer {
    @Resource
    private BaseProducer baseProducer;

    public void delayDeleteCache( DelayDeleteCacheMessage delayDeleteCacheMessage) {
        String content = JSON.toJSONString(delayDeleteCacheMessage);
        log.info("  发送【延迟删除缓存】消息：{}", content);
        baseProducer.send(content, RabbitMQConstant.DELAY_DELETE_CACHE_EXCHANGE, RabbitMQConstant.DELAY_DELETE_CACHE_ROUTING_KEY,
                MessageFailedRetryTypeEnum.DELAY_DELETE_CACHE.getCode());
    }
}